﻿$(document).ready(function () {
    leftSlider.onload();
})

var leftSlider = (function () {

    var init = function () {
    	layui.use('form', function () {
			var form = layui.form;
			form.render();
		});
    }

    return {
        onload : function () {
            init();
            leftSlider.checkClick()
            leftSlider.slider();
            leftSlider.search_slider();
            leftSlider.search_slider_click();
            leftSlider.collectDate();
            leftSlider.collectCheck();
            leftSlider.collectTip();
        },
      	collectShow: function () {
			setTimeout(function () {
				layui.use('layer', function () {
					var layer = layui.layer;
					layer.open({
						type: 1,
						skin: 'layui-layer-demo', //样式类名
						closeBtn: 1, //不显示关闭按钮
						anim: 2,
						title: '添加收藏',
						area: ['1100px', '450px'],
						shadeClose: true, //开启遮罩关闭
						content: $('.wxn_collAdd')

					});
				});

				
			}, 100)
		},
		closeColl:function(){
			layer.closeAll()
		},
		//弹框复选框点击点击事件：
		checkClick:function(){
			$(".wxn_collAdd ul li label").click(function(){
			$(this).toggleClass("active")
		})
		},
        slider:function(){
        	var menulist = {
				    "menulist": [
				    {
				            "ID": "01",
				            "Name": "系统功能",
				            "Url": "",
				            "icon":"icon-favorfill",
				            "menulist": [
				    
				        {
				            "ID": "1",
				            "Name": "申报缴税",
				            "Url": "",
				            "icon":"icon-shenbaonashuix",
				            "menulist": [
				            	{
						            "ID": "101",
						            "Name": "增值税（一般纳税人适用）",
						            "Url": "bsdt/sbqd/sbqd.html",
						            "menulist": [
						            	{
						            		"ID": "10101",
								            "Name": "增值税申报（一般纳税人适用）",
								            "Url": "bsdt/sbqd/sblc_bb.html",
								            "IframeUrl":"bsdt/sbqd/sblc1.html",
								            "menulist": ""
						            	},
						            	{
						            		"ID": "10102",
								            "Name": "附加税（费）申报",
								            "Url": "bsdt/sbqd/sb3.html",
								            "IframeUrl":"bsdt/sbqd/sblc2.html",
								            "menulist": ""
						            	},
						            	{
						            		"ID": "10103",
								            "Name": "房产税申报",
								            "Url": "bsdt/sbqd/sbqd.html",
								            "IframeUrl":"bsdt/sbqd/sblc3.html",
								            "menulist": ""
						            	},
						            	{
						            		"ID": "10104",
								            "Name": "代扣代缴车船税申报",
								            "Url": "bsdt/sbqd/sblc_v2.html",
								            "IframeUrl":"bsdt/sbqd/sblc4.html",
								            "menulist": ""
						            	},
						            	{
						            		"ID": "10105",
								            "Name": "其他税（费）申报",
								            "Url": "bsdt/sbqd/sblc_v3.html",
								            "IframeUrl":"bsdt/sbqd/sblc5.html",
								            "menulist": ""
						            	}
						            ]
						        },
						        {
						            "ID": "102",
						            "Name": "税源信息采集",
						            "Url": "bsdt/xxcj/syxxcj.html",
						            "menulist": ""
						        },
						        {
						            "ID": "104",
						            "Name": "申报作废",
						            "Url": "",
						            "menulist": ""
						        },
						        {
						            "ID": "105",
						            "Name": "申报更正",
						            "Url": "",
						            "menulist": ""
						        },
						        {
						            "ID": "106",
						            "Name": "海关稽查",
						            "Url": "",
						            "menulist": ""
						        },
				            ]
				        },
				        {
				            "ID": "2",
				            "Name": "涉税事项办理",
				            "Url": "",
				            "icon":"icon-sheshuishixiangbanli",
				            "menulist": [
				                {
				                    "ID": "201",
				                    "Name": "税务登记",
				                    "Url": "",
				                    "menulist": [
				                        {
				                            "ID": "20101",
				                            "Name": "变更登记",
				                             "Url": "",
				                            "menulist":""
				                        },
				                        {
				                            "ID": "20102",
				                            "Name": "停业登记",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20103",
				                            "Name": "复业登记",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20104",
				                            "Name": "扣缴义务人登记",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20105",
				                            "Name": "存款账户账号报告",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20106",
				                            "Name": "账务会计制度及核算软件备案报告",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20107",
				                            "Name": "文化事业建设费缴费信息报告",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20108",
				                            "Name": "汽油、柴油生产企业基本情况登记",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20109",
				                            "Name": "证件遗失、损毁管理",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20110",
				                            "Name": "货物运输业小规模纳税人异地代开增值税专用发票备案",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20111",
				                            "Name": "货物运输业小规模纳税人异地代开增值税专用发票备案信息确认",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20112",
				                            "Name": "注销税务登记申请",
				                           "Url": "",
				                            "menulist": ""
				                        }
				                    ]
				                },
				                {
				                    "ID": "202",
				                    "Name": "认定管理",
				                    "Url": "",
				                    "menulist": [
				                        {
				                            "ID": "20201",
				                            "Name": "增值税一般纳税人登记",
				                             "Url": "",
				                            "menulist":""
				                        },
				                        {
				                            "ID": "20202",
				                            "Name": "选择按小规模纳税人纳税",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20203",
				                            "Name": "增值税即征即退资格备案",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20204",
				                            "Name": "对纳税人变更纳税定额的核准",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20205",
				                            "Name": "简并征期申请",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20206",
				                            "Name": "简并征期取消",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20207",
				                            "Name": "一般纳税人简易方法征收备案",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20208",
				                            "Name": "非居民企业选择由其主要机构场所汇总缴纳企业所得税的审批",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20209",
				                            "Name": "对采取实际利润额预缴以外的其他企业所得税预缴方式的核定",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20210",
				                            "Name": "境外注册中资控股企业居民身份认定申请",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20211",
				                            "Name": "企业所得税汇总纳税总分机构信息备案",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20212",
				                            "Name": "增值税、消费税汇总纳税认定",
				                           "Url": "",
				                            "menulist": ""
				                        }
				                    ]
				                },
				                {
				                    "ID": "203",
				                    "Name": "税收优惠",
				                    "Url": "",
				                    "menulist": [
				                        {
				                            "ID": "20301",
				                            "Name": "增值税减免税备案",
				                             "Url": "",
				                            "menulist":""
				                        },
				                        {
				                            "ID": "20302",
				                            "Name": "消费税减免税备案",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20303",
				                            "Name": "增值税即征即退办理",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20304",
				                            "Name": "纳税人放弃免（减）税权备案",
				                           "Url": "",
				                            "menulist": ""
				                        }
				                    ]
				                },
				                {
				                    "ID": "204",
				                    "Name": "申报征收",
				                    "Url": "",
				                    "menulist": [
				                        {
				                            "ID": "20401",
				                            "Name": "延期申报",
				                             "Url": "",
				                            "menulist":""
				                        },
				                        {
				                            "ID": "20402",
				                            "Name": "延期缴纳税款",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20403",
				                            "Name": "多缴税费退（抵）办理",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20404",
				                            "Name": "欠税人处置不动产或大额资产报告",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20405",
				                            "Name": "授权（委托）划缴协议",
				                           "Url": "",
				                            "menulist": ""
				                        }
				                    ]
				                },
				                {
				                    "ID": "205",
				                    "Name": "税收证明",
				                    "Url": "",
				                    "menulist": [
				                        {
				                            "ID": "20501",
				                            "Name": "丢失增值税专用发票已报税证明单开具",
				                             "Url": "",
				                            "menulist":""
				                        },
				                        {
				                            "ID": "20502",
				                            "Name": "《中国税收居民身份证明》开具*",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20503",
				                            "Name": "服务贸易等项目对外支付税务备案",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20504",
				                            "Name": "开具税收完税证明（文书式）",
				                           "Url": "",
				                            "menulist": ""
				                        }
				                    ]
				                },
				                {
				                    "ID": "206",
				                    "Name": "跨区域涉税事项",
				                    "Url": "",
				                    "menulist": [
				                        {
				                            "ID": "20601",
				                            "Name": "跨区域涉税事项报告",
				                             "Url": "",
				                            "menulist":""
				                        },
				                        {
				                            "ID": "20602",
				                            "Name": "跨区域涉税事项报验登记缴销",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20603",
				                            "Name": "跨区域涉税事项延期",
				                           "Url": "",
				                            "menulist": ""
				                        }
				                    ]
				                },
				                {
				                    "ID": "207",
				                    "Name": "涉税专业服务",
				                    "Url": "",
				                    "menulist": [
				                        {
				                            "ID": "20701",
				                            "Name": "涉税专业服务机构实名信息采集",
				                             "Url": "",
				                            "menulist":""
				                        },
				                        {
				                            "ID": "20702",
				                            "Name": "涉税专业服务人员信息采集",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20703",
				                            "Name": "涉税专业服务机构人员、证书关系维护",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20704",
				                            "Name": "涉税专业服务机构（人员）实名信息变更",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20705",
				                            "Name": "涉税专业服务协议信息采集",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20706",
				                            "Name": "涉税专业服务协议信息变更及终止",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20707",
				                            "Name": "涉税专项报告信息采集",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20708",
				                            "Name": "涉税专业服务机构年度报告",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20709",
				                            "Name": "涉税专业服务中止",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20710",
				                            "Name": "涉税专业服务恢复",
				                           "Url": "",
				                            "menulist": ""
				                        }
				                    ]
				                },
				                {
				                    "ID": "208",
				                    "Name": "涉税事项查询",
				                    "Url": "",
				                    "menulist": [
				                        {
				                            "ID": "20801",
				                            "Name": "涉税事项业务查询",
				                             "Url": "",
				                            "menulist":""
				                        },
				                        {
				                            "ID": "20802",
				                            "Name": "流转业务查询",
				                           "Url": "",
				                            "menulist": ""
				                        },
				                        {
				                            "ID": "20803",
				                            "Name": "税务通知书查询",
				                           "Url": "",
				                            "menulist": ""
				                        }
				                    ]
				                }
				            ]
				        },
				        {
				            "ID": "3",
				            "Name": "发票管理",
				            "Url": "",
				            "icon":"icon-coupons_fill",
				            "menulist": [
				            	{
				                    "ID": "301",
				                    "Name": "普通发票票种核定及调整",
				                    "Url": "",
				                    "menulist": ""
				                },
				                {
				                    "ID": "302",
				                    "Name": "印有本单位名称发票核定",
				                    "Url": "",
				                    "menulist": ""
				                },
				                {
				                    "ID": "303",
				                    "Name": "防伪税控系统发票核定及调整",
				                    "Url": "",
				                    "menulist": ""
				                },
				                {
				                    "ID": "304",
				                    "Name": "发票领用",
				                    "Url": "",
				                    "menulist": ""
				                },
				                {
				                    "ID": "305",
				                    "Name": "电子发票领用",
				                    "Url": "",
				                    "menulist": ""
				                },
				                {
				                    "ID": "306",
				                    "Name": "增值税专用发票代开",
				                    "Url": "",
				                    "menulist": ""
				                },
				                {
				                    "ID": "307",
				                    "Name": "增值税发票验交旧",
				                    "Url": "",
				                    "menulist": ""
				                },
				                {
				                    "ID": "308",
				                    "Name": "增值税普通发票代开",
				                    "Url": "",
				                    "menulist": ""
				                },
				                {
				                    "ID": "309",
				                    "Name": "定额发票验交旧",
				                    "Url": "",
				                    "menulist": ""
				                },
				                {
				                    "ID": "310",
				                    "Name": "普通发票挂失、损毁报告",
				                    "Url": "",
				                    "menulist": ""
				                },
				                {
				                    "ID": "311",
				                    "Name": "增值税发票挂失、损毁报备",
				                    "Url": "",
				                    "menulist": ""
				                },
				                {
				                    "ID": "312",
				                    "Name": "增值税专用发票（增值税税控系统）最高开票限额审批*",
				                    "Url": "",
				                    "menulist": ""
				                },
				                {
				                    "ID": "313",
				                    "Name": "购票人维护",
				                    "Url": "",
				                    "menulist": ""
				                }
				            ]
				        },
				        
				        {
				            "ID": "4",
				            "Name": "社保费缴纳",
				            "Url": "",
				            "icon":"icon-addressbook",
				            "menulist": [
				            	{
				                    "ID": "401",
				                    "Name": "单位社会保险费日常申报（全责）",
				                    "Url": "",
				                    "menulist": ""
				                },
				                {
				                    "ID": "402",
				                    "Name": "社会保险费缴纳",
				                    "Url": "",
				                    "menulist": ""
				                }
				            ]
				        },
				          {
				            "ID": "5",
				            "Name": "法律救济",
				            "Url": "",
				             "icon":"icon-tasklist_fill",
				            "menulist": [
				            	{
				                    "ID": "501",
				                    "Name": "违法处置",
				                    "Url": "",
				                    "menulist": ""
				                },
				                {
				                    "ID": "502",
				                    "Name": "纳税担保申请",
				                    "Url": "",
				                    "menulist": ""
				                }
				            
				            ]
				        }
				    ]
				    },
				    {
				    	    "ID": "02",
				            "Name": "个性服务",
				            "Url": "",
				             "icon":"icon-huaban",
				            "menulist": [
				            	{
				                    "ID": "6",
				                    "Name": "涉税事项套餐",
				                    "Url": "",
				                    "icon":"icon-iconwangge-",
				                    "menulist": [
						            	{
						                    "ID": "601",
						                    "Name": "新办那税人套餐服务",
						                    "Url": "",
						                    "menulist": ""
						                },
						                {
						                    "ID": "602",
						                    "Name": "专题套餐服务",
						                    "Url": "",
						                    "menulist": ""
						                },
						                {
						                    "ID": "602",
						                    "Name": "自定义套餐服务",
						                    "Url": "",
						                    "menulist": ""
						                }
						            ]
				                },
				                {
						            "ID": "7",
						            "Name": "银税互动",
						            "Url": "",
						            "icon":"icon-hudongyingxiao",
						            "menulist": [
						            	{
						                    "ID": "701",
						                    "Name": "我的贷款",
						                    "Url": "",
						                    "menulist": ""
						                },
						                {
						                    "ID": "702",
						                    "Name": "我的申请",
						                    "Url": "",
						                    "menulist": ""
						                }
						            ]
								},
								{
									"ID":"8",
									"Name": "涉税风险自查",
									"Url":"",
									"icon":"icon-kuaisuchaxun-",
									"menulist":[]
								}
				            
				            ]
				    }
				    ]
				};
				var showlist = $("<ul></ul>");
				showall(menulist.menulist, showlist);
				$("#sidebar_box").append(showlist);
				function showall(menu_list, parent) {
				    for (var menu in menu_list) {
				        //如果有子节点，则遍历该子节点
				        if (menu_list[menu].menulist.length > 0) {
				            //创建一个子节点li
				            var li = $("<li></li>");
				            var html='<a href="javascript:void(0)" class="menuItem" data-id="' + menu_list[menu].ID + '" data-url="' + menu_list[menu].Url + '"><i class="icon iconfont '+menu_list[menu].icon +'" ></i><span class="menu-text">'+menu_list[menu].Name+'</span><b class="icon iconfont icon-arr-right-red" style="position: absolute;right: 11px;top: 13px;font-size:8px !important"></b></a>'
				            //将li的文本设置好，并马上添加一个空白的ul子节点，并且将这个li添加到父亲节点中
				            $(li).append(html).append("<ul class='submenu'></ul>").appendTo(parent);
				            //将空白的ul作为下一个递归遍历的父亲节点传入
				            showall(menu_list[menu].menulist, $(li).children().eq(1));
				        }
				        //如果该节点没有子节点，则直接将该节点li以及文本创建好直接添加到父亲节点中
				        else {
				        	
				            $("<li></li>").append("<a href='javascript:void(0)' class='menuItem' data-id='" + menu_list[menu].ID + "' data-url='" + menu_list[menu].Url + "'><i class='icon iconfont "+menu_list[menu].icon +"'></i><span class='menu-text'>"+menu_list[menu].Name+"</span></a>").appendTo(parent);
				        }
				    }
			};
			$("#sidebar_box>ul").addClass("nav nav-list").attr("id","nav-list");
			$(".nav-list>li:first-child>a").find("b").addClass("icon-down1").removeClass("icon-arr-right-red")
			$("#sidebar_box").on("click",".menuItem",function(){
				var dataId=$(this).attr("data-id");
				if(dataId==="01"||dataId==="02"){
					$(this).removeClass("active_a");
				}else{
					$(this).addClass("active_a");
				}
				if($(this).next().css("display")==="block"){
					$(this).next().slideUp();
					$(this).find("b").addClass("icon-arr-right-red")
					$(this).find("b").removeClass("icon-down1");
				}else{
					$(this).next().slideDown();
					$(this).find("b").removeClass("icon-arr-right-red")
					$(this).find("b").addClass("icon-down1");
				}
				$(this).parent().siblings("li").find(".submenu").slideUp();
				$(this).parent().siblings("li").find("b").addClass("icon-arr-right-red").removeClass("icon-down1")
				$(this).parent().siblings("li").find("li .submenu").slideUp();
			})
       },
       /*搜索左侧菜单栏*/
      search_slider:function(){
      	$("#titleInput" , parent.document).keyup(function() {
      		$(".search_box" , parent.document).empty().show();
	        var filter = $(this).val();
	        if (filter) {
	            $matches = $("#nav-list li a").find("span:Contains(" + filter + ")").parent("a.menuItem");
	            if($matches.length>0){
		           for(i=0;i<$matches.length;i++){
		           		if($matches[i].getAttribute('data-url')){
		           			var html="<label class='menuItem' data-id='"+$matches[i].getAttribute('data-id')+"' data-url='"+$matches[i].getAttribute('data-url')+"'><span>"+$matches[i].innerText+"</span></label>"
		           			$(".search_box" , parent.document).append(html)
		           		}
		           }
	            }
	        }else{
	        	$(".search_box" , parent.document).empty()
	        }
	        return false;
	    })
      },
      /*点击搜到的菜单展开菜单栏并定位打开*/
     search_slider_click:function(){
     	$(".search_box" , parent.document).on("click","label",function(){
				$(".search_box" , parent.document).empty();
				$("#titleInput" , parent.document).val("")
		        var dataId = $(this).attr('data-id');
		        var dataUrl = $(this).attr('data-url');
		        var menuName = $.trim($(this).text());
		         $(".nav-list li a")
			         .find("span:Contains(" + menuName + ")")
			         .parent("a.menuItem")
			         .addClass("active_a")
			         .parents(".submenu")
			         .slideDown();
				$(".nav-list li a")
					 .find("span:Contains(" + menuName + ")")
			         .parent("a.menuItem").parents("li")
			         .siblings("li").find(".submenu").slideUp();
			        $("#nav-list li a")
					 .find("span:Contains(" + menuName + ")")
			         .parent("a.menuItem").parents("li")
			         .siblings("li"). find("a.menuItem").removeClass("active_a");
			    $(".menu-min .nav-list li a")
			         .find("span:Contains(" + menuName + ")")
			         .parent("a.menuItem")
			         .addClass("active_a")
			         .parents(".submenu")
			         .slideDown();
			
			         
		        var flag = true;
		        if (dataUrl == undefined || $.trim(dataUrl).length == 0) {
		            return false;
		        }
		        $('.menuTab').each(function () {
		            if ($(this).data('id') == dataId) {
		                if (!$(this).hasClass('active')) {
		                    $(this).addClass('active').siblings('.menuTab').removeClass('active');
		                    scrollToTab(this);
		                    $('.mainContent .LRADMS_iframe').each(function () {
		                        if ($(this).data('id') == dataId) {
		                            $(this).show().siblings('.LRADMS_iframe').hide();
		                            return false;
		                        }
		                    });
		                }
		                flag = false;
		                return false;
		            }
		        });
		        if (flag) {
		            var str = '<a href="javascript:;" class="active menuTab" data-url="' + dataUrl + '" data-id="' + dataId + '"><label class="nav_text">' + menuName + '</label><span class="btn_close"><i class="icon iconfont icon-guanbi1"></i></span></a>';
		            $('.menuTab').removeClass('active');
		            var str1 = '<iframe class="LRADMS_iframe" id="iframe' + dataId + '" name="iframe' + dataId + '"  width="100%" height="100%" src="' + dataUrl + '" frameborder="0" data-id="' + dataId + '" data-url="' + dataUrl + '"></iframe>';
		            $('.mainContent').find('iframe.LRADMS_iframe').hide();
		            $('.mainContent').append(str1);
		            $('.mainContent iframe:visible').load(function () {
		                //$.loading(false);
		            });
		            $('.menuTabs .page-tabs-content').append(str);
		            leftSlider.scrollToTab($('.menuTab.active'));
		        }
		        return false;
		        
			})
        },
        /*点击增加菜单栏作用滚动*/
        scrollToTab:function(element) {
            var marginLeftVal = calSumWidth($(element).prevAll()),
            marginRightVal = calSumWidth($(element).nextAll());
            var tabOuterWidth = calSumWidth($(".content-tabs").children().not(".menuTabs"));
            var visibleWidth = $(".content-tabs").outerWidth(true) - tabOuterWidth;
            var scrollVal = 0;
            if ($(".page-tabs-content").outerWidth() < visibleWidth) {
                scrollVal = 0;
            } else if (marginRightVal <= (visibleWidth - $(element).outerWidth(true) - $(element).next().outerWidth(true))) {
                if ((visibleWidth - $(element).next().outerWidth(true)) > marginRightVal) {
                    scrollVal = marginLeftVal;
                    var tabElement = element;
                    while ((scrollVal - $(tabElement).outerWidth()) > ($(".page-tabs-content").outerWidth() - visibleWidth)) {
                        scrollVal -= $(tabElement).prev().outerWidth();
                        tabElement = $(tabElement).prev();
                    }
                }
            } else if (marginLeftVal > (visibleWidth - $(element).outerWidth(true) - $(element).prev().outerWidth(true))) {
                scrollVal = marginLeftVal - $(element).prev().outerWidth(true);
            }
            $('.page-tabs-content').animate({
                marginLeft: 0 - scrollVal + 'px'
            }, "fast");
             function calSumWidth(element) {
	            var width = 0;
	            $(element).each(function () {
	                width += $(this).outerWidth(true);
	            });
	            return width;
	        } 
        },
        /*收藏弹框数据展示*/
       collectDate:function(){
       		var menulist = {
				    "menulist": [
				        {
				            "Name": "申报纳税",
				            "menulist": [
				            	{
						            "Name": "申报清单",
						            "menulist": ""
						        },
						        {
						            "Name": "货物运输业小规模纳税人异地代开增值税专用发票备案信息确认",
						            "menulist": ""
						        },
						        {
						            "Name": "申报清单",
						            "menulist": ""
						        },
						        {
						            "Name": "税源信息采集",
						            "menulist": ""
						        },
						        {
						            "Name": "申报清单",
						            "menulist": ""
						        },
						        {
						            "Name": "税源信息采集",
						            "menulist": ""
						        },
						        {
						            "Name": "申报清单",
						            "menulist": ""
						        },
						        {
						            "Name": "税源信息采集",
						            "menulist": ""
						        },
						        {
						            "Name": "申报清单",
						            "menulist": ""
						        },
						        {
						            "Name": "税源信息采集",
						            "menulist": ""
						        },
						       
				            ]
				        
				        },
				          {
				            "Name": "法律救济",
				            "menulist": [
				            	{
				                    "Name": "违法处置",
				                    "menulist": ""
				                },
				                {
				                    "Name": "纳税担保申请",
				                    "menulist": ""
				                }
				            
				            ]
				        }
				    ]
				};
		        var showlist = $("<ul></ul>");
		        showall(menulist.menulist, showlist);
		        $(".wxl_collSwdj").append(showlist);
				function showall(menu_list, parent) {
				    for (var menu in menu_list) {
				        if (menu_list[menu].menulist.length > 0) {
				            var li = $("<li></li>");
				            $(li).append("<label></label><span>"+menu_list[menu].Name+"</span>").append("<ul class='submenu'></ul>").appendTo(parent);
				            showall(menu_list[menu].menulist, $(li).children().eq(2));
				        }
				        else {
				             $("<li></li>").append("<label></label><span>"+menu_list[menu].Name+"</span>").appendTo(parent);
				        }
				    }
				};
       },
       /*收藏弹框复选框事件*/
        collectCheck:function(){
        	$(".wxl_collSwdj").on("click","label",function(){
				$(this).toggleClass("active");
			});
        },
        /*弹框搜索提示框*/
       collectTip:function(){
       		 $(".wxl_coll_input").keyup(function(){
			 	$(".wxl_tip_box ul").empty().show();
			 	var filter=$(this).val();
			 	console.log(filter)
			 	if(filter){
			 		 $matches = $(".wxl_collSwdj li>.submenu").find("span:Contains(" + filter + ")");
		            if($matches.length>0){
			           for(i=0;i<$matches.length;i++){
		           			var html="<li>"+$matches[i].innerText+"</li>";
		           			$(".wxl_tip_box ul").append(html)
			           }
		            }
			 	}else{
			 		$(".wxl_tip_box ul").empty()
			 	}
			 	return false;
			 });
			 $(".wxl_tip_box").on("click","li",function(){
			 	var liText=$(this).text();
			 	$(".wxl_coll_input").val(liText);
			 	$(".wxl_tip_box ul").empty();
			 })
       }

    }
})();
